<?php
namespace app\validate;
use share\validate\SceneValidate;

class UrlSelectorValidate extends SceneValidate{

    /**
     * 通用规则
     */
    protected $rule = [
        'id' => 'require|integer',
        'account' => 'require|integer|>:0',
        'oauth' => 'require|integer|>:0',
        'burn' => 'require|integer|>:0',
        'oss' => 'require|integer|>:0',
        'h5' => 'require|integer|>:0',
        'sim' => 'require|integer|>:0',
        'appShare' => 'require|integer|>:0',
        'selector' => 'require|array',
        'key' => 'require|length:2,16',
        'value' => 'require|length:2,500',
        'group_id' => 'integer|>=:0',
    ];    

    /**
     * 自定义场景的规则
     */
    protected $sceneRules = [
        'check' => [
            'ip' => 'ip',
            'vendor' => 'length:2,40',
            'package' => 'length:2,40',
            'version' => 'length:2,40',
            'client' => 'length:2,40',
            'did' => 'length:2,64',
            'client_type' => 'require|integer',
        ],
    ];

    protected $scene = [
        'checkRelation' => ['ip','vendor','package','version','client','client_type','did'],
        'alloc' => ['id','account','oauth','burn','oss','h5','sim','appShare','selector','group_id'],
        'selectorItem' => ['key','value'],
        'del'  => ['id'],
    ];
}
